package com.jeln.dao;

import com.jeln.po.Type;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface TypeRepository extends JpaRepository<Type,Long> {

    //根据名称查询type
    Type findByName(String name);

    //通过名称查询type，分类对应博客由大到小排序
    @Query("select t from Type t")
    List<Type> findTop(Pageable pageable);

}
